package com.example.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author ：songxusheng
 * @description：测试Controller
 * @date ：Created in 2022/6/23 12:28
 * @version:
 */
@RestController
public class ConsumerTestController {
    @Resource
    private RestTemplate restTemplate;

    private final String SERVICE_URL = "http://nacos-provider-openFeign";

    // 通过Nacos调用下级服务
    @GetMapping("/consumerTest")
    public String consumerTest() {
        return restTemplate.getForObject(SERVICE_URL + "/goodsServiceTest", String.class);
    }
}
